package com.yygo.dao;

import com.yygo.model.*;
import org.displaytag.properties.SortOrderEnum;

import java.util.Date;
import java.util.List;
import java.util.Set;

/**
 * Created by tiansha on 2015/6/13.
 */
public interface LoanRequestDao extends GenericDao<LoanRequest, Long> {

    LoanRequest loadWholeLoanRequest(Long id);

    LoanRequest getLoanRequest(Long id);

    List<Feedback> getFeedbacks(Long reqId);

    int getLoanRequestCount(User user, String status, Date date, String number, String name);
    List<LoanRequest> searchLoanRequests(User user, String status, Date date, String number, String name, int firstResult, int maxResults, SortOrderEnum sortDirection, String sortCriterion);

    int getLoanedToTransferRequestsCount(User user, Date date, String number, String name);
    List<LoanRequest> getLoanedToTransferRequests(User user, Date date, String number, String name, int firstResult, int maxResults, SortOrderEnum sortDirection, String sortCriterion);

    int getMyLoanRequestCount(String phase, User user);

    int getMyBondLoanRequestsCount(User user, Date date, String name, String salesman) throws IllegalAccessException;
    List<LoanRequest> getMyBondLoanRequests(User user, Date date, String name, String salesman, int firstResult, int maxResults, SortOrderEnum sortDirection, String sortCriterion) throws IllegalAccessException;

    List<LoanRequest> getMyLoanRequests(String phase, User user, int firstResult, int maxResults, SortOrderEnum sortDirection, String sortCriterion);

    LoanRequest getNextForRuleProcessing();

    Set<LoanRequest> getRequestsForSlave();

    LoanRequest getLoanRequestByNumber(String number);

    int getRecentRequestCountByDealer(Dealer dealer, int days);
    int getRecentDeniedRequestCountByDealer(Dealer dealer, int days);

    LoanRequest saveLoanRequest(LoanRequest loanRequest);
}
